package nuc.jyg.dto;

/**
 * 封装json对象，所有返回结果都适用它
 *
 * @Author Nuc YongGuang Ji
 * Created by JiYongGuang on 2017/5/31.
 */
public class Result<T> {

    private boolean success; // 是否成功标志

    private T data; // 成功时返回的数据

    private String error; // 错误信息

    public Result() {
    }

    /**
     * 成功时候的构造器
     *
     * @param success
     * @param data
     */
    public Result(boolean success, T data) {
        this.success = success;
        this.data = data;
    }

    /**
     * 失败时候的构造器
     *
     * @param success
     * @param error
     */
    public Result(boolean success, String error) {
        this.success = success;
        this.error = error;
    }

    /**
     * Getter for property 'success'.
     *
     * @return Value for property 'success'.
     */
    public boolean isSuccess() {
        return success;
    }

    /**
     * Setter for property 'success'.
     *
     * @param success Value to set for property 'success'.
     */
    public void setSuccess(boolean success) {
        this.success = success;
    }

    /**
     * Getter for property 'data'.
     *
     * @return Value for property 'data'.
     */
    public T getData() {
        return data;
    }

    /**
     * Setter for property 'data'.
     *
     * @param data Value to set for property 'data'.
     */
    public void setData(T data) {
        this.data = data;
    }

    /**
     * Getter for property 'error'.
     *
     * @return Value for property 'error'.
     */
    public String getError() {
        return error;
    }

    /**
     * Setter for property 'error'.
     *
     * @param error Value to set for property 'error'.
     */
    public void setError(String error) {
        this.error = error;
    }
}
